<HTML> 
<HEAD> 
	<TITLE>3rd Party ROBOTC Drivers</TITLE> 
<link href="tabs.css" rel="stylesheet" type="text/css"/> 
<link href="doxygen.css" rel="stylesheet" type="text/css"/> 
</HEAD> 
 
<BODY bgcolor="#ffffff" link="#000000" vlink="#000000"> 
<table width="100%" bgcolor="navy" cellspacing=0 cellpadding=1 border=0> 
<tr><td><table width="100%" bgcolor="#EEEEDD" cellspacing=0 cellpadding=3 border=0> 
<tr> 
    <td width="33%" align="left"> <img src="images/LOGO_NXT.gif" width=266 height=44 border="0" alt="Mindstorms"></td> 
    <td><b><font size="+3" color="navy">3rd Party ROBOTC Drivers</font></b></td> 
    <td align="right"> <img src="images/logo.png" width=44 height=44 border="0" alt="RobotC"></td>     
</tr> 
  <tr bgcolor="#cccc99" align="right"> 
          <td colspan=3> <font face="arial" size="-1"> [<a href=main.html>Home</a>] [<a target=_top href="https://sourceforge.net/projects/rdpartyrobotcdr/">Download</a>] [<a target=_top href="http://apps.sourceforge.net/mantisbt/rdpartyrobotcdr/my_view_page.php">Submit a bug/suggestion</a>]  [<a target=_top href="http://www.robotc.net/forums/">ROBOTC Forums</a>] [<a target=_top href="http://botbench.com">Blog</a>] [<a target=_top href="http://sourceforge.net/donate/index.php?group_id=257238">Support this project</a>]</font> </td> 
</tr> 
</table></td></tr> 
</table> 
<!-- Generated by Doxygen 1.7.2 -->
<div class="header">
  <div class="headertitle">
<h1>hitechnic-irlink.h</h1>  </div>
</div>
<div class="contents">
<a href="hitechnic-irlink_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*!@addtogroup HiTechnic</span>
<a name="l00002"></a>00002 <span class="comment"> * @{</span>
<a name="l00003"></a>00003 <span class="comment"> * @defgroup htirl IR Link Sensor</span>
<a name="l00004"></a>00004 <span class="comment"> * HiTechnic IR Link Sensor driver</span>
<a name="l00005"></a>00005 <span class="comment"> * @{</span>
<a name="l00006"></a>00006 <span class="comment"> */</span>
<a name="l00007"></a>00007 
<a name="l00008"></a>00008 <span class="comment">/*</span>
<a name="l00009"></a>00009 <span class="comment"> * $Id: hitechnic-irlink.h 133 2013-03-10 15:15:38Z xander $</span>
<a name="l00010"></a>00010 <span class="comment"> */</span>
<a name="l00011"></a>00011 
<a name="l00012"></a>00012 <span class="preprocessor">#ifndef _HTIRL_H_</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="preprocessor">#define _HTIRL_H_</span>
<a name="l00014"></a>00014 <span class="preprocessor"></span><span class="comment">/** \file hitechnic-irlink.h</span>
<a name="l00015"></a>00015 <span class="comment"> * \brief HiTechnic IR Link Sensor driver</span>
<a name="l00016"></a>00016 <span class="comment"> *</span>
<a name="l00017"></a>00017 <span class="comment"> * hitechnic-irlink.h provides an API for the HiTechnic IR Link Sensor.</span>
<a name="l00018"></a>00018 <span class="comment"> *</span>
<a name="l00019"></a>00019 <span class="comment"> * Changelog:</span>
<a name="l00020"></a>00020 <span class="comment"> * - 1.0: Initial release</span>
<a name="l00021"></a>00021 <span class="comment"> * - 1.1: Minor changes</span>
<a name="l00022"></a>00022 <span class="comment"> * - 1.2: Rewrite to make use of the new common.h API</span>
<a name="l00023"></a>00023 <span class="comment"> * - 1.3: Clarified port numbering</span>
<a name="l00024"></a>00024 <span class="comment"> * - 1.4: Removed inline functions</span>
<a name="l00025"></a>00025 <span class="comment"> * - 1.5: Added PFsinglePinOutputMode() functionality to control motors without a timeout\n</span>
<a name="l00026"></a>00026 <span class="comment"> *        Added PFmotor() as a wrapper for PFsinglePinOutputMode()\n</span>
<a name="l00027"></a>00027 <span class="comment"> *        eCPMMotorCommand has been replaced with more generic ePWMMotorCommand\n</span>
<a name="l00028"></a>00028 <span class="comment"> *        transmitIR() now works according to the specs\n</span>
<a name="l00029"></a>00029 <span class="comment"> *</span>
<a name="l00030"></a>00030 <span class="comment"> * Credits:</span>
<a name="l00031"></a>00031 <span class="comment"> * - Big thanks to HiTechnic for providing me with the hardware necessary to write and test this.</span>
<a name="l00032"></a>00032 <span class="comment"> *</span>
<a name="l00033"></a>00033 <span class="comment"> * License: You may use this code as you wish, provided you give credit where its due.</span>
<a name="l00034"></a>00034 <span class="comment"> *</span>
<a name="l00035"></a>00035 <span class="comment"> * THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 3.59 AND HIGHER. </span>
<a name="l00036"></a>00036 <span class="comment"></span>
<a name="l00037"></a>00037 <span class="comment"> * \author Xander Soldaat (xander_at_botbench.com)</span>
<a name="l00038"></a>00038 <span class="comment"> * \date 25 May 2010</span>
<a name="l00039"></a>00039 <span class="comment"> * \version 1.4</span>
<a name="l00040"></a>00040 <span class="comment"> * \example hitechnic-irlink-test1.c</span>
<a name="l00041"></a>00041 <span class="comment"> */</span>
<a name="l00042"></a>00042 
<a name="l00043"></a>00043 <span class="preprocessor">#pragma systemFile</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span>
<a name="l00045"></a>00045 <span class="comment">//#define _DEBUG_DRIVER_    /*!&lt; Compile the driver with debugging code */</span>
<a name="l00046"></a>00046 
<a name="l00047"></a>00047 <span class="preprocessor">#ifdef _DEBUG_DRIVER_</span>
<a name="l00048"></a>00048 <span class="preprocessor"></span><span class="preprocessor">#warn &quot;-----------------------------------------&quot;</span>
<a name="l00049"></a>00049 <span class="preprocessor"></span><span class="preprocessor">#warn &quot;HTIRL DRIVER COMPILED WITH DEBUGGING CODE&quot;</span>
<a name="l00050"></a>00050 <span class="preprocessor"></span><span class="preprocessor">#warn &quot;-----------------------------------------&quot;</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span>
<a name="l00053"></a>00053 <span class="preprocessor">#ifndef _COMMON_H_</span>
<a name="l00054"></a>00054 <span class="preprocessor"></span><span class="preprocessor">#include &quot;<a class="code" href="common_8h.html" title="Commonly used functions used by drivers.">common.h</a>&quot;</span>
<a name="l00055"></a>00055 <span class="preprocessor">#endif</span>
<a name="l00056"></a>00056 <span class="preprocessor"></span>
<a name="l00057"></a><a class="code" href="group__htirl.html#ga9f0115a31d1a380b72d67a2dfa1b512d">00057</a> <span class="preprocessor">#define BUF_HEADSIZE    3   </span><span class="comment">/*!&lt; I2C buff size, address and register */</span>
<a name="l00058"></a><a class="code" href="group__htirl.html#ga91b88040238ff376ea9ede8045ab1213">00058</a> <span class="preprocessor">#define BUF_DATASIZE    11  </span><span class="comment">/*!&lt; max size of encoded buffer */</span>
<a name="l00059"></a><a class="code" href="group__htirl.html#gae280edca9b8c3437de1ebcc82ee76a85">00059</a> <span class="preprocessor">#define BUF_TAILSIZE    3   </span><span class="comment">/*!&lt; IR data length, IR Link mode and start transmission */</span>
<a name="l00060"></a><a class="code" href="group__htirl.html#ga68b7b0075c1695448ef9d091bf870a1f">00060</a> <span class="preprocessor">#define START_HEAD      0   </span><span class="comment">/*!&lt; index of start of header */</span>
<a name="l00061"></a><a class="code" href="group__htirl.html#gaf58e8696eec8cb522925bf02c3d37a53">00061</a> <span class="preprocessor">#define START_DATA      3   </span><span class="comment">/*!&lt; index of start of data payload */</span>
<a name="l00062"></a><a class="code" href="group__htirl.html#gaa0ad6a524fc050e5d5e65982c34843c2">00062</a> <span class="preprocessor">#define START_TAIL      15  </span><span class="comment">/*!&lt; index of start of tail */</span>
<a name="l00063"></a>00063 
<a name="l00064"></a><a class="code" href="group__htirl.html#ga84c7ad37ee371a9ea844c826d2a9756f">00064</a> <span class="preprocessor">#define PFSPORT(X) X / 8</span>
<a name="l00065"></a><a class="code" href="group__htirl.html#ga201d65aeab944a1f9c9d07e7b575ef96">00065</a> <span class="preprocessor"></span><span class="preprocessor">#define PFCHAN(X) (X % 8) / 2</span>
<a name="l00066"></a><a class="code" href="group__htirl.html#ga47db229cf1be8ea6ea7b13c9c1d5ecb3">00066</a> <span class="preprocessor"></span><span class="preprocessor">#define PFMOT(X) X % 2</span>
<a name="l00067"></a>00067 <span class="preprocessor"></span>
<a name="l00068"></a><a class="code" href="group__htirl.html#ga0c81ab0677f80c959ef6da884ac03f55">00068</a> byte <a class="code" href="group__htirl.html#ga0c81ab0677f80c959ef6da884ac03f55">toggle</a>[4] = {0, 0, 0, 0};
<a name="l00069"></a>00069 <span class="comment"></span>
<a name="l00070"></a>00070 <span class="comment">/*!&lt; Motor connections */</span>
<a name="l00071"></a><a class="code" href="group__htirl.html#ga39dc14fd7972d5ad5fddd8cd1a62fd5b">00071</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
<a name="l00072"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba7494aff8c386091c4ff989e7a369b201">00072</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba7494aff8c386091c4ff989e7a369b201">pfmotor_S1_C1_A</a> = 0,  <span class="comment">/*!&lt; Motor A, Channel 1, IR Link connected to S1 */</span>
<a name="l00073"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5bad0dcdc02cb2762dc4d1317325cdbd17f">00073</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5bad0dcdc02cb2762dc4d1317325cdbd17f">pfmotor_S1_C1_B</a>,      <span class="comment">/*!&lt; Motor B, Channel 1, IR Link connected to S1 */</span>
<a name="l00074"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba29322c15c07fd45b7ff632c263c4429f">00074</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba29322c15c07fd45b7ff632c263c4429f">pfmotor_S1_C2_A</a>,      <span class="comment">/*!&lt; Motor A, Channel 2, IR Link connected to S1 */</span>
<a name="l00075"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba2744d4c431475503f0033979346356a4">00075</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba2744d4c431475503f0033979346356a4">pfmotor_S1_C2_B</a>,      <span class="comment">/*!&lt; Motor B, Channel 2, IR Link connected to S1 */</span>
<a name="l00076"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5babdc968dd53b711112e355b0ae800440e">00076</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5babdc968dd53b711112e355b0ae800440e">pfmotor_S1_C3_A</a>,      <span class="comment">/*!&lt; Motor A, Channel 3, IR Link connected to S1 */</span>
<a name="l00077"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5badc84de12ae026e9a3a3ea3996dceeab2">00077</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5badc84de12ae026e9a3a3ea3996dceeab2">pfmotor_S1_C3_B</a>,      <span class="comment">/*!&lt; Motor B, Channel 3, IR Link connected to S1 */</span>
<a name="l00078"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba7568dae041b781630375b4a08696d6f3">00078</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba7568dae041b781630375b4a08696d6f3">pfmotor_S1_C4_A</a>,      <span class="comment">/*!&lt; Motor A, Channel 4, IR Link connected to S1 */</span>
<a name="l00079"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5bafd9cb57f3159a8a6162ef96ef2557bb5">00079</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5bafd9cb57f3159a8a6162ef96ef2557bb5">pfmotor_S1_C4_B</a>,      <span class="comment">/*!&lt; Motor B, Channel 4, IR Link connected to S1 */</span>
<a name="l00080"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5bacfee47ae3f4e8751577fe86e0fddcd7d">00080</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5bacfee47ae3f4e8751577fe86e0fddcd7d">pfmotor_S2_C1_A</a>,      <span class="comment">/*!&lt; Motor A, Channel 1, IR Link connected to S2 */</span>
<a name="l00081"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5baffb8a078a5cac436675b8b23cdaabf8a">00081</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5baffb8a078a5cac436675b8b23cdaabf8a">pfmotor_S2_C1_B</a>,      <span class="comment">/*!&lt; Motor B, Channel 1, IR Link connected to S2 */</span>
<a name="l00082"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba33471e39048464bd2ece186b51db955e">00082</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba33471e39048464bd2ece186b51db955e">pfmotor_S2_C2_A</a>,      <span class="comment">/*!&lt; Motor A, Channel 2, IR Link connected to S2 */</span>
<a name="l00083"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5bab68086ae88b5bd70530c08f593818022">00083</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5bab68086ae88b5bd70530c08f593818022">pfmotor_S2_C2_B</a>,      <span class="comment">/*!&lt; Motor B, Channel 2, IR Link connected to S2 */</span>
<a name="l00084"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba0c1d994ed0033f8df728718db8c03b9c">00084</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba0c1d994ed0033f8df728718db8c03b9c">pfmotor_S2_C3_A</a>,      <span class="comment">/*!&lt; Motor A, Channel 3, IR Link connected to S2 */</span>
<a name="l00085"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5baf4b0b20b0aa4a463174ab2d67e8121e5">00085</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5baf4b0b20b0aa4a463174ab2d67e8121e5">pfmotor_S2_C3_B</a>,      <span class="comment">/*!&lt; Motor B, Channel 3, IR Link connected to S2 */</span>
<a name="l00086"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5baa547d63294747568687163e7075fdcd4">00086</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5baa547d63294747568687163e7075fdcd4">pfmotor_S2_C4_A</a>,      <span class="comment">/*!&lt; Motor A, Channel 4, IR Link connected to S2 */</span>
<a name="l00087"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba64a3ba85222ab2b5d294071f4bbae2c4">00087</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba64a3ba85222ab2b5d294071f4bbae2c4">pfmotor_S2_C4_B</a>,      <span class="comment">/*!&lt; Motor B, Channel 4, IR Link connected to S2 */</span>
<a name="l00088"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba22c2ed3c04fe670fa4338c68cd04b437">00088</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba22c2ed3c04fe670fa4338c68cd04b437">pfmotor_S3_C1_A</a>,      <span class="comment">/*!&lt; Motor A, Channel 1, IR Link connected to S3 */</span>
<a name="l00089"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba391f635f1a4c0aa8dcd29395e76ec522">00089</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba391f635f1a4c0aa8dcd29395e76ec522">pfmotor_S3_C1_B</a>,      <span class="comment">/*!&lt; Motor B, Channel 1, IR Link connected to S3 */</span>
<a name="l00090"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba8e33e5e3cf726feedf4457831420f5a2">00090</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba8e33e5e3cf726feedf4457831420f5a2">pfmotor_S3_C2_A</a>,      <span class="comment">/*!&lt; Motor A, Channel 2, IR Link connected to S3 */</span>
<a name="l00091"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba5610c932c07851727fc136aabbb2fd3c">00091</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba5610c932c07851727fc136aabbb2fd3c">pfmotor_S3_C2_B</a>,      <span class="comment">/*!&lt; Motor B, Channel 2, IR Link connected to S3 */</span>
<a name="l00092"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5bab87fde0d289e909994576af84739283e">00092</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5bab87fde0d289e909994576af84739283e">pfmotor_S3_C3_A</a>,      <span class="comment">/*!&lt; Motor A, Channel 3, IR Link connected to S3 */</span>
<a name="l00093"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba06933ed636f72c271611a306ecfec1a0">00093</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba06933ed636f72c271611a306ecfec1a0">pfmotor_S3_C3_B</a>,      <span class="comment">/*!&lt; Motor B, Channel 3, IR Link connected to S3 */</span>
<a name="l00094"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5bac456bc23bd9755c12eda9897147f0500">00094</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5bac456bc23bd9755c12eda9897147f0500">pfmotor_S3_C4_A</a>,      <span class="comment">/*!&lt; Motor A, Channel 4, IR Link connected to S3 */</span>
<a name="l00095"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba655f10b96e343bff5f76f0bd91a55f46">00095</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba655f10b96e343bff5f76f0bd91a55f46">pfmotor_S3_C4_B</a>,      <span class="comment">/*!&lt; Motor B, Channel 4, IR Link connected to S3 */</span>
<a name="l00096"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5baf15b90fedacae121af68ddb98e3f4558">00096</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5baf15b90fedacae121af68ddb98e3f4558">pfmotor_S4_C1_A</a>,      <span class="comment">/*!&lt; Motor A, Channel 1, IR Link connected to S4 */</span>
<a name="l00097"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba501e82b850a81015b1869fed04e3fd36">00097</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba501e82b850a81015b1869fed04e3fd36">pfmotor_S4_C1_B</a>,      <span class="comment">/*!&lt; Motor B, Channel 1, IR Link connected to S4 */</span>
<a name="l00098"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5bac8a242589db421feee81b09de4a0d4ec">00098</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5bac8a242589db421feee81b09de4a0d4ec">pfmotor_S4_C2_A</a>,      <span class="comment">/*!&lt; Motor A, Channel 2, IR Link connected to S4 */</span>
<a name="l00099"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba209405be5279be6962ad6c7c73524fe9">00099</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba209405be5279be6962ad6c7c73524fe9">pfmotor_S4_C2_B</a>,      <span class="comment">/*!&lt; Motor B, Channel 2, IR Link connected to S4 */</span>
<a name="l00100"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba3f892a94e0e5a119eeaf5b5ec8d257f6">00100</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba3f892a94e0e5a119eeaf5b5ec8d257f6">pfmotor_S4_C3_A</a>,      <span class="comment">/*!&lt; Motor A, Channel 3, IR Link connected to S4 */</span>
<a name="l00101"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba66b5db4e09d5e8948d4eb10f7d039fe0">00101</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba66b5db4e09d5e8948d4eb10f7d039fe0">pfmotor_S4_C3_B</a>,      <span class="comment">/*!&lt; Motor B, Channel 3, IR Link connected to S4 */</span>
<a name="l00102"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba41364f5f16bff2ebdb15376003cb2aa2">00102</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba41364f5f16bff2ebdb15376003cb2aa2">pfmotor_S4_C4_A</a>,      <span class="comment">/*!&lt; Motor A, Channel 4, IR Link connected to S4 */</span>
<a name="l00103"></a><a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba6bd5060efa34807f7ef132bf2107cfbd">00103</a>   <a class="code" href="group__htirl.html#gga39dc14fd7972d5ad5fddd8cd1a62fd5ba6bd5060efa34807f7ef132bf2107cfbd">pfmotor_S4_C4_B</a>,      <span class="comment">/*!&lt; Motor B, Channel 4, IR Link connected to S4 */</span>
<a name="l00104"></a>00104 } <a class="code" href="group__htirl.html#ga39dc14fd7972d5ad5fddd8cd1a62fd5b">tPFmotor</a>;
<a name="l00105"></a>00105 
<a name="l00106"></a>00106 <span class="comment"></span>
<a name="l00107"></a>00107 <span class="comment">/*!&lt; PWM Mode commands */</span>
<a name="l00108"></a><a class="code" href="group__htirl.html#ga9c3c0063406d1dabd1b18f2b27e83487">00108</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
<a name="l00109"></a><a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487ad737a185468b4a87612a3c73b1941d32">00109</a>   <a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487ad737a185468b4a87612a3c73b1941d32">MOTOR_FLOAT</a> = 0,      <span class="comment">/*!&lt; Float the motor */</span>
<a name="l00110"></a><a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487af87735230f59fc26457ac2d0e0c8d500">00110</a>   <a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487af87735230f59fc26457ac2d0e0c8d500">MOTOR_FWD_PWM_1</a> = 1,  <span class="comment">/*!&lt; Forward speed 1 */</span>
<a name="l00111"></a><a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487a730c42805aa94913d5d18c86fa9a5039">00111</a>   <a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487a730c42805aa94913d5d18c86fa9a5039">MOTOR_FWD_PWM_2</a> = 2,  <span class="comment">/*!&lt; Forward speed 2 */</span>
<a name="l00112"></a><a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487abeae20711af8dd7b45f07d0078024f32">00112</a>   <a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487abeae20711af8dd7b45f07d0078024f32">MOTOR_FWD_PWM_3</a> = 3,  <span class="comment">/*!&lt; Forward speed 3 */</span>
<a name="l00113"></a><a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487a2803a16c85e95f9d86d7a1ec94d7629e">00113</a>   <a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487a2803a16c85e95f9d86d7a1ec94d7629e">MOTOR_FWD_PWM_4</a> = 4,  <span class="comment">/*!&lt; Forward speed 4 */</span>
<a name="l00114"></a><a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487a63cdcb2bc07d3a86aa3cf1dee168036f">00114</a>   <a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487a63cdcb2bc07d3a86aa3cf1dee168036f">MOTOR_FWD_PWM_5</a> = 5,  <span class="comment">/*!&lt; Forward speed 5 */</span>
<a name="l00115"></a><a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487adc4cebf765a9810c8dcfb16fb6436fa7">00115</a>   <a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487adc4cebf765a9810c8dcfb16fb6436fa7">MOTOR_FWD_PWM_6</a> = 6,  <span class="comment">/*!&lt; Forward speed 6 */</span>
<a name="l00116"></a><a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487af9670289acbb72b9d74390cbf1ad71eb">00116</a>   <a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487af9670289acbb72b9d74390cbf1ad71eb">MOTOR_FWD_PWM_7</a> = 7,  <span class="comment">/*!&lt; Forward speed 7 */</span>
<a name="l00117"></a><a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487a80c01e43e1dbf1cb4d8445f951859530">00117</a>   <a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487a80c01e43e1dbf1cb4d8445f951859530">MOTOR_BRAKE</a> = 8,      <span class="comment">/*!&lt; Brake the motor */</span>
<a name="l00118"></a><a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487a9caaf738698a6b80a16194847c67dddb">00118</a>   <a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487a9caaf738698a6b80a16194847c67dddb">MOTOR_REV_PWM_7</a> = 9,  <span class="comment">/*!&lt; Reverse speed 7 */</span>
<a name="l00119"></a><a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487a82ef50d985b19a44de1e78ff4571fc35">00119</a>   <a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487a82ef50d985b19a44de1e78ff4571fc35">MOTOR_REV_PWM_6</a> = 10, <span class="comment">/*!&lt; Reverse speed 6 */</span>
<a name="l00120"></a><a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487ad0f3e18d5bf3faf0d944405667355d81">00120</a>   <a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487ad0f3e18d5bf3faf0d944405667355d81">MOTOR_REV_PWM_5</a> = 11, <span class="comment">/*!&lt; Reverse speed 5 */</span>
<a name="l00121"></a><a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487a28f6bf1f50dec769093eabacf22974e7">00121</a>   <a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487a28f6bf1f50dec769093eabacf22974e7">MOTOR_REV_PWM_4</a> = 12, <span class="comment">/*!&lt; Reverse speed 4 */</span>
<a name="l00122"></a><a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487a87c4344670bad9a2c571bfd3eccb15cb">00122</a>   <a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487a87c4344670bad9a2c571bfd3eccb15cb">MOTOR_REV_PWM_3</a> = 13, <span class="comment">/*!&lt; Reverse speed 3 */</span>
<a name="l00123"></a><a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487add955b9434e283d8d6670b088cbbacab">00123</a>   <a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487add955b9434e283d8d6670b088cbbacab">MOTOR_REV_PWM_2</a> = 14, <span class="comment">/*!&lt; Reverse speed 2 */</span>
<a name="l00124"></a><a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487a99dcd5cae4d0936f6b05115d907a4337">00124</a>   <a class="code" href="group__htirl.html#gga9c3c0063406d1dabd1b18f2b27e83487a99dcd5cae4d0936f6b05115d907a4337">MOTOR_REV_PWM_1</a> = 15  <span class="comment">/*!&lt; Reverse speed 1 */</span>
<a name="l00125"></a>00125 } <a class="code" href="group__htirl.html#ga9c3c0063406d1dabd1b18f2b27e83487">ePWMMotorCommand</a>;
<a name="l00126"></a>00126 <span class="comment"></span>
<a name="l00127"></a>00127 <span class="comment">/*!&lt; Combo Direct Mode commands */</span>
<a name="l00128"></a><a class="code" href="group__htirl.html#gac9c310f7de4ef728365b829d296d9b34">00128</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
<a name="l00129"></a><a class="code" href="group__htirl.html#ggac9c310f7de4ef728365b829d296d9b34a024e0d2e8e929d10ab128e99ffb4d2bf">00129</a>   <a class="code" href="group__htirl.html#ggac9c310f7de4ef728365b829d296d9b34a024e0d2e8e929d10ab128e99ffb4d2bf">CDM_MOTOR_FLOAT</a> = 0,      <span class="comment">/*!&lt; Float the motor */</span>
<a name="l00130"></a><a class="code" href="group__htirl.html#ggac9c310f7de4ef728365b829d296d9b34a595bd736267af8fb533b735b9765b601">00130</a>   <a class="code" href="group__htirl.html#ggac9c310f7de4ef728365b829d296d9b34a595bd736267af8fb533b735b9765b601">CDM_MOTOR_FWD</a> = 1,        <span class="comment">/*!&lt; Forward */</span>
<a name="l00131"></a><a class="code" href="group__htirl.html#ggac9c310f7de4ef728365b829d296d9b34a9d19050420be57a557a3e063745f2504">00131</a>   <a class="code" href="group__htirl.html#ggac9c310f7de4ef728365b829d296d9b34a9d19050420be57a557a3e063745f2504">CDM_MOTOR_BAK</a> = 2,        <span class="comment">/*!&lt; Reverse */</span>
<a name="l00132"></a><a class="code" href="group__htirl.html#ggac9c310f7de4ef728365b829d296d9b34a824870df549686104759f89a4398dacd">00132</a>   <a class="code" href="group__htirl.html#ggac9c310f7de4ef728365b829d296d9b34a824870df549686104759f89a4398dacd">CDM_MOTOR_BRAKE</a> = 3       <span class="comment">/*!&lt; Brake the motor */</span>
<a name="l00133"></a>00133 } <a class="code" href="group__htirl.html#gac9c310f7de4ef728365b829d296d9b34">eCDMMotorCommand</a>;
<a name="l00134"></a>00134 
<a name="l00135"></a>00135 <span class="comment">// Function prototypes</span>
<a name="l00136"></a>00136 <span class="comment">// inline void addI2CHead(tByteArray &amp;data);</span>
<a name="l00137"></a>00137 <span class="comment">// inline void addI2CTail(tByteArray &amp;data);</span>
<a name="l00138"></a>00138 <span class="keywordtype">void</span> <a class="code" href="group__htirl.html#ga3f38d6d4421a9e49bd4ea79ebe1012d6">PFcomboDirectMode</a>(tSensors link, <span class="keywordtype">int</span> channel, <a class="code" href="group__htirl.html#gac9c310f7de4ef728365b829d296d9b34">eCDMMotorCommand</a> _motorB, <a class="code" href="group__htirl.html#gac9c310f7de4ef728365b829d296d9b34">eCDMMotorCommand</a> _motorA);
<a name="l00139"></a>00139 <span class="keywordtype">void</span> <a class="code" href="group__htirl.html#ga9f9d921939a7bcf5ec940d5ad0c2dab2">PFcomboPwmMode</a>(tSensors link, <span class="keywordtype">int</span> channel, <a class="code" href="group__htirl.html#ga9c3c0063406d1dabd1b18f2b27e83487">ePWMMotorCommand</a> _motorB, <a class="code" href="group__htirl.html#ga9c3c0063406d1dabd1b18f2b27e83487">ePWMMotorCommand</a> _motorA);
<a name="l00140"></a>00140 <span class="keywordtype">void</span> <a class="code" href="group__htirl.html#ga01dcee117740162d7d438dff743ab5a9">encodeBuffer</a>(<a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a> &amp;iBuffer, <a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a> &amp;oBuffer);
<a name="l00141"></a>00141 <span class="keywordtype">void</span> <a class="code" href="group__htirl.html#ga990f903c4954696e33979bc21c4f4b61">transmitIR</a>(tSensors link, <a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a> &amp;oBuffer, <span class="keywordtype">int</span> channel);
<a name="l00142"></a>00142 
<a name="l00143"></a>00143 <span class="preprocessor">#ifdef _DEBUG_DRIVER_</span>
<a name="l00144"></a>00144 <span class="preprocessor"></span><span class="keywordtype">void</span> <a class="code" href="group__htirl.html#ga9632dba95881a5247a7d266490a2fdb7">decToBin</a>(<span class="keywordtype">int</span> number, <span class="keywordtype">int</span> length, <span class="keywordtype">string</span> &amp;output);
<a name="l00145"></a>00145 <span class="keywordtype">void</span> <a class="code" href="group__htirl.html#ga36b7bd4c3e586f8b215d924a93dd2397">debugIR</a>(<a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a> &amp;data);
<a name="l00146"></a>00146 
<a name="l00147"></a>00147 <span class="comment"></span>
<a name="l00148"></a>00148 <span class="comment">/**</span>
<a name="l00149"></a>00149 <span class="comment"> * Returns a binary representation in a string of an int with specified length</span>
<a name="l00150"></a>00150 <span class="comment"> *</span>
<a name="l00151"></a>00151 <span class="comment"> * Note: this function is only available when driver is compiled with _DEBUG_DRIVER_ defined.</span>
<a name="l00152"></a>00152 <span class="comment"> * @param number the number to be converted to a binary representation</span>
<a name="l00153"></a>00153 <span class="comment"> * @param length number of bits to convert</span>
<a name="l00154"></a>00154 <span class="comment"> * @param output the number converted to binary representation</span>
<a name="l00155"></a>00155 <span class="comment"> */</span>
<a name="l00156"></a><a class="code" href="group__htirl.html#ga9632dba95881a5247a7d266490a2fdb7">00156</a> <span class="keywordtype">void</span> <a class="code" href="group__htirl.html#ga9632dba95881a5247a7d266490a2fdb7">decToBin</a>(<span class="keywordtype">int</span> number, <span class="keywordtype">int</span> length, <span class="keywordtype">string</span> &amp;output) {
<a name="l00157"></a>00157   memset(output, 0, <span class="keyword">sizeof</span>(output));
<a name="l00158"></a>00158   output = <span class="stringliteral">&quot;&quot;</span>;
<a name="l00159"></a>00159 
<a name="l00160"></a>00160   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; length; i++) {
<a name="l00161"></a>00161     output += (number &amp; (1&lt;&lt; (length - 1))) &gt;&gt; (length - 1);
<a name="l00162"></a>00162     number = number &lt;&lt; 1;
<a name="l00163"></a>00163   }
<a name="l00164"></a>00164 }
<a name="l00165"></a>00165 
<a name="l00166"></a>00166 <span class="comment"></span>
<a name="l00167"></a>00167 <span class="comment">/**</span>
<a name="l00168"></a>00168 <span class="comment"> * Print out the buffer in question to the screen using the following format:</span>
<a name="l00169"></a>00169 <span class="comment"> *</span>
<a name="l00170"></a>00170 <span class="comment"> * @&lt;index@&gt; @&lt;binary reprentation@&gt; @&lt;hex representation@&gt;</span>
<a name="l00171"></a>00171 <span class="comment"> *</span>
<a name="l00172"></a>00172 <span class="comment"> * 0 11001100 0xCC</span>
<a name="l00173"></a>00173 <span class="comment"> *</span>
<a name="l00174"></a>00174 <span class="comment"> * It pauses for 10 seconds between each screenful, accompanied by a beep.</span>
<a name="l00175"></a>00175 <span class="comment"> *</span>
<a name="l00176"></a>00176 <span class="comment"> * Note: this function is only available when driver is compiled with _DEBUG_DRIVER_ defined.</span>
<a name="l00177"></a>00177 <span class="comment"> * @param data the data to be displayed as binary/hex numbers</span>
<a name="l00178"></a>00178 <span class="comment"> */</span>
<a name="l00179"></a><a class="code" href="group__htirl.html#ga36b7bd4c3e586f8b215d924a93dd2397">00179</a> <span class="keywordtype">void</span> <a class="code" href="group__htirl.html#ga36b7bd4c3e586f8b215d924a93dd2397">debugIR</a>(<a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a> &amp;data) {
<a name="l00180"></a>00180   <span class="keywordtype">string</span> _output;
<a name="l00181"></a>00181   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="group__common.html#gaf80235eb257dc97cb46655fde261602e">MAX_ARR_SIZE</a>; i++) {
<a name="l00182"></a>00182     <span class="keywordflow">if</span> ((i != 0) &amp;&amp; (i % 8 == 0)) {
<a name="l00183"></a>00183       wait1Msec(10000);
<a name="l00184"></a>00184       PlaySound(soundBlip);
<a name="l00185"></a>00185       eraseDisplay();
<a name="l00186"></a>00186     }
<a name="l00187"></a>00187     <a class="code" href="group__htirl.html#ga9632dba95881a5247a7d266490a2fdb7">decToBin</a>(data[i], 8, _output);
<a name="l00188"></a>00188     StringFormat(_output, <span class="stringliteral">&quot;%2d %s&quot;</span>, i, _output);
<a name="l00189"></a>00189     nxtDisplayTextLine(i % 8, <span class="stringliteral">&quot;%s 0x%02x&quot;</span>, _output, ubyteToInt(data[i]));
<a name="l00190"></a>00190   }
<a name="l00191"></a>00191   wait1Msec(10000);
<a name="l00192"></a>00192 }
<a name="l00193"></a>00193 <span class="preprocessor">#endif // _DEBUG_DRIVER_</span>
<a name="l00194"></a>00194 <span class="preprocessor"></span>
<a name="l00195"></a>00195 <span class="comment"></span>
<a name="l00196"></a>00196 <span class="comment">/**</span>
<a name="l00197"></a>00197 <span class="comment"> * Control two motors using the ComboDirectMode.  This mode does not allow for fine grained</span>
<a name="l00198"></a>00198 <span class="comment"> * speed control.</span>
<a name="l00199"></a>00199 <span class="comment"> * @param link the sensor port number</span>
<a name="l00200"></a>00200 <span class="comment"> * @param channel the channel of the receiver we wish to communicate with, numbered 0-3</span>
<a name="l00201"></a>00201 <span class="comment"> * @param _motorB the command to be sent to Motor B</span>
<a name="l00202"></a>00202 <span class="comment"> * @param _motorA the command to be sent to Motor A</span>
<a name="l00203"></a>00203 <span class="comment"> */</span>
<a name="l00204"></a><a class="code" href="group__htirl.html#ga3f38d6d4421a9e49bd4ea79ebe1012d6">00204</a> <span class="keywordtype">void</span> <a class="code" href="group__htirl.html#ga3f38d6d4421a9e49bd4ea79ebe1012d6">PFcomboDirectMode</a>(tSensors link, <span class="keywordtype">int</span> channel, <a class="code" href="group__htirl.html#gac9c310f7de4ef728365b829d296d9b34">eCDMMotorCommand</a> _motorB, <a class="code" href="group__htirl.html#gac9c310f7de4ef728365b829d296d9b34">eCDMMotorCommand</a> _motorA) {
<a name="l00205"></a>00205   <a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a> _iBuffer;
<a name="l00206"></a>00206   <a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a> _oBuffer;
<a name="l00207"></a>00207 
<a name="l00208"></a>00208   <span class="comment">// Clear the input buffer before we start filling it</span>
<a name="l00209"></a>00209   memset(_iBuffer, 0, <span class="keyword">sizeof</span>(<a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a>));
<a name="l00210"></a>00210   memset(_oBuffer, 0, <span class="keyword">sizeof</span>(<a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a>));
<a name="l00211"></a>00211 
<a name="l00212"></a>00212   <span class="comment">// This is the unencoded command for the IR receiver</span>
<a name="l00213"></a>00213   _iBuffer[0] = (channel &lt;&lt; 4) + 1;
<a name="l00214"></a>00214   _iBuffer[1] = ((ubyte)_motorB &lt;&lt; 6) + ((ubyte)_motorA &lt;&lt; 4);
<a name="l00215"></a>00215   _iBuffer[1] += 0xF ^ (_iBuffer[0] &gt;&gt; 4) ^ (_iBuffer[0] &amp; 0xF) ^ (_iBuffer[1] &gt;&gt; 4);
<a name="l00216"></a>00216 
<a name="l00217"></a>00217   <span class="comment">// Setup the header of the I2C packet</span>
<a name="l00218"></a>00218   _oBuffer[0] = 16;    <span class="comment">// Total msg length</span>
<a name="l00219"></a>00219   _oBuffer[1] = 0x02;  <span class="comment">// I2C device address</span>
<a name="l00220"></a>00220   _oBuffer[2] = 0x42;  <span class="comment">// Internal register</span>
<a name="l00221"></a>00221 
<a name="l00222"></a>00222   <span class="comment">// Generate the data payload</span>
<a name="l00223"></a>00223   <a class="code" href="group__htirl.html#ga01dcee117740162d7d438dff743ab5a9">encodeBuffer</a>(_iBuffer, (<a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a>)_oBuffer);                       <span class="comment">// Encode PF command</span>
<a name="l00224"></a>00224 
<a name="l00225"></a>00225   <span class="comment">// Setup the tail end of the packet</span>
<a name="l00226"></a>00226   _oBuffer[<a class="code" href="group__htirl.html#ga9f0115a31d1a380b72d67a2dfa1b512d">BUF_HEADSIZE</a> + <a class="code" href="group__htirl.html#ga91b88040238ff376ea9ede8045ab1213">BUF_DATASIZE</a>] = 11;         <span class="comment">// Total IR command length</span>
<a name="l00227"></a>00227   _oBuffer[<a class="code" href="group__htirl.html#ga9f0115a31d1a380b72d67a2dfa1b512d">BUF_HEADSIZE</a> + <a class="code" href="group__htirl.html#ga91b88040238ff376ea9ede8045ab1213">BUF_DATASIZE</a> + 1] = 0x02;   <span class="comment">// IRLink mode 0x02 is PF motor</span>
<a name="l00228"></a>00228   _oBuffer[<a class="code" href="group__htirl.html#ga9f0115a31d1a380b72d67a2dfa1b512d">BUF_HEADSIZE</a> + <a class="code" href="group__htirl.html#ga91b88040238ff376ea9ede8045ab1213">BUF_DATASIZE</a> + 2] = 0x01;   <span class="comment">// Start transmitting</span>
<a name="l00229"></a>00229 
<a name="l00230"></a>00230   <a class="code" href="group__htirl.html#ga990f903c4954696e33979bc21c4f4b61">transmitIR</a>(link, _oBuffer, channel);
<a name="l00231"></a>00231 }
<a name="l00232"></a>00232 
<a name="l00233"></a>00233 
<a name="l00234"></a>00234 <span class="comment">/*</span>
<a name="l00235"></a>00235 <span class="comment">  =============================================================================</span>
<a name="l00236"></a>00236 <span class="comment">  Combo Direct Mode</span>
<a name="l00237"></a>00237 <span class="comment">        | Nib 1 | Nib 2 | Nib 3 | Nib 4 |</span>
<a name="l00238"></a>00238 <span class="comment">  start  a 1 C C B B B B A A A A L L L L stop</span>
<a name="l00239"></a>00239 <span class="comment"></span>
<a name="l00240"></a>00240 <span class="comment"> */</span><span class="comment"></span>
<a name="l00241"></a>00241 <span class="comment">/**</span>
<a name="l00242"></a>00242 <span class="comment"> * Control two motors using the ComboPWMMode.  This mode allows for fine grained</span>
<a name="l00243"></a>00243 <span class="comment"> * speed control.</span>
<a name="l00244"></a>00244 <span class="comment"> * @param link the sensor port number</span>
<a name="l00245"></a>00245 <span class="comment"> * @param channel the channel of the receiver we wish to communicate with, numbered 0-3</span>
<a name="l00246"></a>00246 <span class="comment"> * @param _motorB the command to be sent to Motor B</span>
<a name="l00247"></a>00247 <span class="comment"> * @param _motorA the command to be sent to Motor A</span>
<a name="l00248"></a>00248 <span class="comment"> */</span>
<a name="l00249"></a><a class="code" href="group__htirl.html#ga9f9d921939a7bcf5ec940d5ad0c2dab2">00249</a> <span class="keywordtype">void</span> <a class="code" href="group__htirl.html#ga9f9d921939a7bcf5ec940d5ad0c2dab2">PFcomboPwmMode</a>(tSensors link, <span class="keywordtype">int</span> channel, <a class="code" href="group__htirl.html#ga9c3c0063406d1dabd1b18f2b27e83487">ePWMMotorCommand</a> _motorB, <a class="code" href="group__htirl.html#ga9c3c0063406d1dabd1b18f2b27e83487">ePWMMotorCommand</a> _motorA) {
<a name="l00250"></a>00250   <a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a> _iBuffer;
<a name="l00251"></a>00251   <a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a> _oBuffer;
<a name="l00252"></a>00252 
<a name="l00253"></a>00253   <span class="comment">// Clear the input buffer before we start filling it</span>
<a name="l00254"></a>00254   memset(_iBuffer, 0, <span class="keyword">sizeof</span>(<a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a>));
<a name="l00255"></a>00255   memset(_oBuffer, 0, <span class="keyword">sizeof</span>(<a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a>));
<a name="l00256"></a>00256 
<a name="l00257"></a>00257   <span class="comment">// This is the unencoded command for the IR receiver</span>
<a name="l00258"></a>00258   _iBuffer[0] = (1 &lt;&lt; 6) + (channel &lt;&lt; 4) + _motorA;
<a name="l00259"></a>00259   _iBuffer[1] = ((ubyte)_motorB &lt;&lt; 4);
<a name="l00260"></a>00260   <span class="comment">//_iBuffer[1] = (_motorB &lt;&lt; 4) + (0xF ^ ((1 &lt;&lt; 2) + channel) ^ _motorA ^ _motorB);</span>
<a name="l00261"></a>00261   _iBuffer[1] += 0xF ^ (_iBuffer[0] &gt;&gt; 4) ^ (_iBuffer[0] &amp; 0xF) ^ (_iBuffer[1] &gt;&gt; 4);
<a name="l00262"></a>00262 
<a name="l00263"></a>00263   <span class="comment">// Setup the header of the I2C packet</span>
<a name="l00264"></a>00264   _oBuffer[0] = 16;    <span class="comment">// Total msg length</span>
<a name="l00265"></a>00265   _oBuffer[1] = 0x02;  <span class="comment">// I2C device address</span>
<a name="l00266"></a>00266   _oBuffer[2] = 0x42;  <span class="comment">// Internal register</span>
<a name="l00267"></a>00267   <span class="comment">// Generate the data payload</span>
<a name="l00268"></a>00268   <a class="code" href="group__htirl.html#ga01dcee117740162d7d438dff743ab5a9">encodeBuffer</a>(_iBuffer, _oBuffer);                       <span class="comment">// Encode PF command</span>
<a name="l00269"></a>00269 
<a name="l00270"></a>00270   <span class="comment">// Setup the tail end of the packet</span>
<a name="l00271"></a>00271   _oBuffer[<a class="code" href="group__htirl.html#ga9f0115a31d1a380b72d67a2dfa1b512d">BUF_HEADSIZE</a> + <a class="code" href="group__htirl.html#ga91b88040238ff376ea9ede8045ab1213">BUF_DATASIZE</a>] = 11;         <span class="comment">// Total IR command length</span>
<a name="l00272"></a>00272   _oBuffer[<a class="code" href="group__htirl.html#ga9f0115a31d1a380b72d67a2dfa1b512d">BUF_HEADSIZE</a> + <a class="code" href="group__htirl.html#ga91b88040238ff376ea9ede8045ab1213">BUF_DATASIZE</a> + 1] = 0x02;   <span class="comment">// IRLink mode 0x02 is PF motor</span>
<a name="l00273"></a>00273   _oBuffer[<a class="code" href="group__htirl.html#ga9f0115a31d1a380b72d67a2dfa1b512d">BUF_HEADSIZE</a> + <a class="code" href="group__htirl.html#ga91b88040238ff376ea9ede8045ab1213">BUF_DATASIZE</a> + 2] = 0x01;   <span class="comment">// Start transmitting</span>
<a name="l00274"></a>00274   <span class="comment">//_oBuffer[3] = 0x80;</span>
<a name="l00275"></a>00275 
<a name="l00276"></a>00276   <a class="code" href="group__htirl.html#ga990f903c4954696e33979bc21c4f4b61">transmitIR</a>(link, _oBuffer, channel);
<a name="l00277"></a>00277 }
<a name="l00278"></a>00278 
<a name="l00279"></a>00279 
<a name="l00280"></a>00280 <span class="comment">/*</span>
<a name="l00281"></a>00281 <span class="comment">  =============================================================================</span>
<a name="l00282"></a>00282 <span class="comment">  Single Pin Output Mode</span>
<a name="l00283"></a>00283 <span class="comment">        | Nib 1 | Nib 2 | Nib 3 | Nib 4 |</span>
<a name="l00284"></a>00284 <span class="comment">  start  T 0 C C a 1 M 0 D D D D L L L L stop</span>
<a name="l00285"></a>00285 <span class="comment"></span>
<a name="l00286"></a>00286 <span class="comment"> */</span><span class="comment"></span>
<a name="l00287"></a>00287 <span class="comment">/**</span>
<a name="l00288"></a>00288 <span class="comment"> * Control one motor with no timeout. This mode allows for fine grained</span>
<a name="l00289"></a>00289 <span class="comment"> * speed control.</span>
<a name="l00290"></a>00290 <span class="comment"> * @param link the sensor port number</span>
<a name="l00291"></a>00291 <span class="comment"> * @param channel the channel of the receiver we wish to communicate with, numbered 0-3</span>
<a name="l00292"></a>00292 <span class="comment"> * @param _motor the motor to be controlled, 0 or 1, for A or B</span>
<a name="l00293"></a>00293 <span class="comment"> * @param _motorCmd the command to send to the motor, 0-15</span>
<a name="l00294"></a>00294 <span class="comment"> */</span>
<a name="l00295"></a><a class="code" href="group__htirl.html#ga71ddacfaa98256c678a241bd86b72d21">00295</a> <span class="keywordtype">void</span> <a class="code" href="group__htirl.html#ga71ddacfaa98256c678a241bd86b72d21">PFsinglePinOutputMode</a>(tSensors link, ubyte channel, ubyte _motor, <a class="code" href="group__htirl.html#ga9c3c0063406d1dabd1b18f2b27e83487">ePWMMotorCommand</a> _motorCmd) {
<a name="l00296"></a>00296   <a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a> _iBuffer;
<a name="l00297"></a>00297   <a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a> _oBuffer;
<a name="l00298"></a>00298 
<a name="l00299"></a>00299   <a class="code" href="group__htirl.html#ga0c81ab0677f80c959ef6da884ac03f55">toggle</a>[link] ^= 1;
<a name="l00300"></a>00300 
<a name="l00301"></a>00301   <span class="comment">// Clear the input buffer before we start filling it</span>
<a name="l00302"></a>00302   memset(_iBuffer, 0, <span class="keyword">sizeof</span>(<a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a>));
<a name="l00303"></a>00303   memset(_oBuffer, 0, <span class="keyword">sizeof</span>(<a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a>));
<a name="l00304"></a>00304 
<a name="l00305"></a>00305   <span class="comment">// This is the unencoded command for the IR receiver</span>
<a name="l00306"></a>00306   _iBuffer[0] = (<a class="code" href="group__htirl.html#ga0c81ab0677f80c959ef6da884ac03f55">toggle</a>[link] &lt;&lt;7 ) + (channel &lt;&lt; 4) + (1 &lt;&lt; 2) + _motor;
<a name="l00307"></a>00307   _iBuffer[1] = ((ubyte)_motorCmd &lt;&lt; 4);
<a name="l00308"></a>00308   _iBuffer[1] += 0xF ^ (_iBuffer[0] &gt;&gt; 4) ^ (_iBuffer[0] &amp; 0xF) ^ (_iBuffer[1] &gt;&gt; 4);
<a name="l00309"></a>00309 
<a name="l00310"></a>00310   <span class="comment">// Setup the header of the I2C packet</span>
<a name="l00311"></a>00311   _oBuffer[0] = 16;    <span class="comment">// Total msg length</span>
<a name="l00312"></a>00312   _oBuffer[1] = 0x02;  <span class="comment">// I2C device address</span>
<a name="l00313"></a>00313   _oBuffer[2] = 0x42;  <span class="comment">// Internal register</span>
<a name="l00314"></a>00314   <span class="comment">// Generate the data payload</span>
<a name="l00315"></a>00315   <a class="code" href="group__htirl.html#ga01dcee117740162d7d438dff743ab5a9">encodeBuffer</a>(_iBuffer, _oBuffer);                       <span class="comment">// Encode PF command</span>
<a name="l00316"></a>00316 
<a name="l00317"></a>00317   <span class="comment">// Setup the tail end of the packet</span>
<a name="l00318"></a>00318   _oBuffer[<a class="code" href="group__htirl.html#ga9f0115a31d1a380b72d67a2dfa1b512d">BUF_HEADSIZE</a> + <a class="code" href="group__htirl.html#ga91b88040238ff376ea9ede8045ab1213">BUF_DATASIZE</a>] = 11;         <span class="comment">// Total IR command length</span>
<a name="l00319"></a>00319   _oBuffer[<a class="code" href="group__htirl.html#ga9f0115a31d1a380b72d67a2dfa1b512d">BUF_HEADSIZE</a> + <a class="code" href="group__htirl.html#ga91b88040238ff376ea9ede8045ab1213">BUF_DATASIZE</a> + 1] = 0x02;   <span class="comment">// IRLink mode 0x02 is PF motor</span>
<a name="l00320"></a>00320   _oBuffer[<a class="code" href="group__htirl.html#ga9f0115a31d1a380b72d67a2dfa1b512d">BUF_HEADSIZE</a> + <a class="code" href="group__htirl.html#ga91b88040238ff376ea9ede8045ab1213">BUF_DATASIZE</a> + 2] = 0x01;   <span class="comment">// Start transmitting</span>
<a name="l00321"></a>00321 
<a name="l00322"></a>00322   <a class="code" href="group__htirl.html#ga990f903c4954696e33979bc21c4f4b61">transmitIR</a>(link, _oBuffer, channel);
<a name="l00323"></a>00323 }
<a name="l00324"></a>00324 
<a name="l00325"></a>00325 <span class="comment"></span>
<a name="l00326"></a>00326 <span class="comment">/**</span>
<a name="l00327"></a>00327 <span class="comment"> * Control one motor with no timeout. This mode allows for fine grained</span>
<a name="l00328"></a>00328 <span class="comment"> * speed control.</span>
<a name="l00329"></a>00329 <span class="comment"> * @param pfmotor the motor to which to send the command</span>
<a name="l00330"></a>00330 <span class="comment"> * @param _motorCmd the command to send to the motor, 0-15</span>
<a name="l00331"></a>00331 <span class="comment"> */</span>
<a name="l00332"></a><a class="code" href="group__htirl.html#ga7dd0cfb4544284046a7528f1c9fb18c5">00332</a> <span class="keywordtype">void</span> <a class="code" href="group__htirl.html#ga7dd0cfb4544284046a7528f1c9fb18c5">PFMotor</a>(<a class="code" href="group__htirl.html#ga39dc14fd7972d5ad5fddd8cd1a62fd5b">tPFmotor</a> pfmotor, <a class="code" href="group__htirl.html#ga9c3c0063406d1dabd1b18f2b27e83487">ePWMMotorCommand</a> _motorCmd) {
<a name="l00333"></a>00333   <a class="code" href="group__htirl.html#ga71ddacfaa98256c678a241bd86b72d21">PFsinglePinOutputMode</a>((tSensors)<a class="code" href="group__htirl.html#ga84c7ad37ee371a9ea844c826d2a9756f">PFSPORT</a>(pfmotor), (ubyte)<a class="code" href="group__htirl.html#ga201d65aeab944a1f9c9d07e7b575ef96">PFCHAN</a>(pfmotor), (ubyte)<a class="code" href="group__htirl.html#ga47db229cf1be8ea6ea7b13c9c1d5ecb3">PFMOT</a>(pfmotor), _motorCmd);
<a name="l00334"></a>00334 }
<a name="l00335"></a>00335 
<a name="l00336"></a>00336 <span class="comment"></span>
<a name="l00337"></a>00337 <span class="comment">/**</span>
<a name="l00338"></a>00338 <span class="comment"> * Encode the input buffer into a special format for the IRLink.</span>
<a name="l00339"></a>00339 <span class="comment"> *</span>
<a name="l00340"></a>00340 <span class="comment"> * Note: this is an internal function and should not be called directly.</span>
<a name="l00341"></a>00341 <span class="comment"> * @param iBuffer the data that is be encoded</span>
<a name="l00342"></a>00342 <span class="comment"> * @param oBuffer output buffer for encoded data</span>
<a name="l00343"></a>00343 <span class="comment"> */</span>
<a name="l00344"></a><a class="code" href="group__htirl.html#ga01dcee117740162d7d438dff743ab5a9">00344</a> <span class="keywordtype">void</span> <a class="code" href="group__htirl.html#ga01dcee117740162d7d438dff743ab5a9">encodeBuffer</a>(<a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a> &amp;iBuffer, <a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a> &amp;oBuffer) {
<a name="l00345"></a>00345   <span class="keywordtype">int</span> _oByteIdx = 0;
<a name="l00346"></a>00346   <span class="keywordtype">int</span> _oBitIdx = 0;
<a name="l00347"></a>00347   <span class="keywordtype">int</span> _iIndex = 0;              <span class="comment">// _iBUffer bit index</span>
<a name="l00348"></a>00348   <span class="keywordtype">int</span> _oIndex = 0;              <span class="comment">// _oBuffer bit index</span>
<a name="l00349"></a>00349   <span class="keywordtype">int</span> _len = 0;
<a name="l00350"></a>00350 
<a name="l00351"></a>00351   <span class="comment">//debugIR(iBuffer);</span>
<a name="l00352"></a>00352   <span class="comment">// Calculate the size of the output bit index</span>
<a name="l00353"></a>00353   _oIndex = (8 * (<a class="code" href="group__common.html#gaf80235eb257dc97cb46655fde261602e">MAX_ARR_SIZE</a> - <a class="code" href="group__htirl.html#ga9f0115a31d1a380b72d67a2dfa1b512d">BUF_HEADSIZE</a>)) - 1;
<a name="l00354"></a>00354 
<a name="l00355"></a>00355   <span class="comment">// Start bit is a special case and is encoded as 0x80</span>
<a name="l00356"></a>00356   oBuffer[<a class="code" href="group__htirl.html#gaf58e8696eec8cb522925bf02c3d37a53">START_DATA</a>] = 0x80; <span class="comment">// Start bit</span>
<a name="l00357"></a>00357   _oIndex -= 8;                   <span class="comment">// move the index along 8 bits.</span>
<a name="l00358"></a>00358 
<a name="l00359"></a>00359   <span class="comment">// Bits in the input buffer are encoded as follows:</span>
<a name="l00360"></a>00360   <span class="comment">// 1 is encoded as 10000</span>
<a name="l00361"></a>00361   <span class="comment">// 0 is encoded as 100</span>
<a name="l00362"></a>00362   <span class="comment">// The encoded bits are tacked onto the end of the output</span>
<a name="l00363"></a>00363   <span class="comment">// buffer, byte boundaries are ignored.</span>
<a name="l00364"></a>00364   <span class="keywordflow">for</span> (_iIndex = 0; _iIndex &lt; (2 * 8); _iIndex++) {
<a name="l00365"></a>00365     _len = (iBuffer[_iIndex / 8] &amp; 0x80) ? 5 : 3;
<a name="l00366"></a>00366     _oByteIdx = (<a class="code" href="group__common.html#gaf80235eb257dc97cb46655fde261602e">MAX_ARR_SIZE</a> - 1) - (_oIndex / 8);
<a name="l00367"></a>00367     _oBitIdx = _oIndex % 8;
<a name="l00368"></a>00368     oBuffer[_oByteIdx] += (1 &lt;&lt; _oBitIdx);
<a name="l00369"></a>00369     _oIndex -= _len;
<a name="l00370"></a>00370     iBuffer[_iIndex / 8] &lt;&lt;= 1;
<a name="l00371"></a>00371   }
<a name="l00372"></a>00372 
<a name="l00373"></a>00373   <span class="comment">// Finally, add the stop byte to the end of our command</span>
<a name="l00374"></a>00374   _oByteIdx = (<a class="code" href="group__common.html#gaf80235eb257dc97cb46655fde261602e">MAX_ARR_SIZE</a> - 1) - (_oIndex / 8);
<a name="l00375"></a>00375   _oBitIdx = _oIndex % 8;
<a name="l00376"></a>00376   oBuffer[_oByteIdx] += (1 &lt;&lt; _oBitIdx);
<a name="l00377"></a>00377 
<a name="l00378"></a>00378 }
<a name="l00379"></a>00379 
<a name="l00380"></a>00380 <span class="comment"></span>
<a name="l00381"></a>00381 <span class="comment">/**</span>
<a name="l00382"></a>00382 <span class="comment"> * Send the command to the IRLink Sensor for transmission.</span>
<a name="l00383"></a>00383 <span class="comment"> *</span>
<a name="l00384"></a>00384 <span class="comment"> * Note: this is an internal function and should not be called directly.</span>
<a name="l00385"></a>00385 <span class="comment"> * If the driver is compiled with _DEBUG_DRIVER_, this function will call</span>
<a name="l00386"></a>00386 <span class="comment"> * debugIR() prior to transmitting the data for debugging purposes.</span>
<a name="l00387"></a>00387 <span class="comment"> * @param link the sensor port number</span>
<a name="l00388"></a>00388 <span class="comment"> * @param oBuffer the data that is be transmitted</span>
<a name="l00389"></a>00389 <span class="comment"> * @param channel the channel number of the receiver</span>
<a name="l00390"></a>00390 <span class="comment"> */</span>
<a name="l00391"></a><a class="code" href="group__htirl.html#ga990f903c4954696e33979bc21c4f4b61">00391</a> <span class="keywordtype">void</span> <a class="code" href="group__htirl.html#ga990f903c4954696e33979bc21c4f4b61">transmitIR</a>(tSensors link, <a class="code" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a> &amp;oBuffer, <span class="keywordtype">int</span> channel) {
<a name="l00392"></a>00392   <span class="keywordtype">long</span> starttime = 0;
<a name="l00393"></a>00393 <span class="preprocessor">#ifdef _DEBUG_DRIVER_</span>
<a name="l00394"></a>00394 <span class="preprocessor"></span>  <a class="code" href="group__htirl.html#ga36b7bd4c3e586f8b215d924a93dd2397">debugIR</a>(oBuffer);
<a name="l00395"></a>00395 <span class="preprocessor">#endif // _DEBUG_DRIVER_</span>
<a name="l00396"></a>00396 <span class="preprocessor"></span>
<a name="l00397"></a>00397   <span class="comment">// Channel is assumed to be 1-4 in the specs.</span>
<a name="l00398"></a>00398   <span class="comment">// channel++;</span>
<a name="l00399"></a>00399 
<a name="l00400"></a>00400   <span class="comment">// Message should be sent 5 times according to the PF specs</span>
<a name="l00401"></a>00401   <span class="comment">// Specific timing has to be used to prevent interence with other</span>
<a name="l00402"></a>00402   <span class="comment">// transmitters.</span>
<a name="l00403"></a>00403 
<a name="l00404"></a>00404   <span class="comment">// First transmission</span>
<a name="l00405"></a>00405   wait1Msec((4 - channel) * 16);
<a name="l00406"></a>00406   starttime = nPgmTime;
<a name="l00407"></a>00407   <span class="keywordflow">if</span> (!<a class="code" href="group__common.html#gad02e06f83b264ee6fc7df41eb4712080">writeI2C</a>(link, oBuffer)) <span class="keywordflow">return</span>;
<a name="l00408"></a>00408 
<a name="l00409"></a>00409   <span class="comment">// Second transmission</span>
<a name="l00410"></a>00410   wait1Msec(5 * 16 - (nPgmTime - starttime));
<a name="l00411"></a>00411   starttime = nPgmTime;
<a name="l00412"></a>00412   <span class="keywordflow">if</span> (!<a class="code" href="group__common.html#gad02e06f83b264ee6fc7df41eb4712080">writeI2C</a>(link, oBuffer)) <span class="keywordflow">return</span>;
<a name="l00413"></a>00413 
<a name="l00414"></a>00414   <span class="comment">// Third transmission</span>
<a name="l00415"></a>00415   wait1Msec(5 * 16 - (nPgmTime - starttime));
<a name="l00416"></a>00416   starttime = nPgmTime;
<a name="l00417"></a>00417   <span class="keywordflow">if</span> (!<a class="code" href="group__common.html#gad02e06f83b264ee6fc7df41eb4712080">writeI2C</a>(link, oBuffer)) <span class="keywordflow">return</span>;
<a name="l00418"></a>00418 
<a name="l00419"></a>00419   <span class="comment">// Fourth transmission</span>
<a name="l00420"></a>00420   wait1Msec((6 + (2*channel) * 16) - (nPgmTime - starttime));
<a name="l00421"></a>00421   starttime = nPgmTime;
<a name="l00422"></a>00422   <span class="keywordflow">if</span> (!<a class="code" href="group__common.html#gad02e06f83b264ee6fc7df41eb4712080">writeI2C</a>(link, oBuffer)) <span class="keywordflow">return</span>;
<a name="l00423"></a>00423 
<a name="l00424"></a>00424   <span class="comment">// Fifth transmission</span>
<a name="l00425"></a>00425   wait1Msec((6 + (2*channel) * 16) - (nPgmTime - starttime));
<a name="l00426"></a>00426   <span class="keywordflow">if</span> (!<a class="code" href="group__common.html#gad02e06f83b264ee6fc7df41eb4712080">writeI2C</a>(link, oBuffer)) <span class="keywordflow">return</span>;
<a name="l00427"></a>00427 }
<a name="l00428"></a>00428 
<a name="l00429"></a>00429 <span class="preprocessor">#endif // _HTIRL_H_</span>
<a name="l00430"></a>00430 <span class="preprocessor"></span>
<a name="l00431"></a>00431 <span class="comment">/*</span>
<a name="l00432"></a>00432 <span class="comment"> * $Id: hitechnic-irlink.h 133 2013-03-10 15:15:38Z xander $</span>
<a name="l00433"></a>00433 <span class="comment"> */</span>
<a name="l00434"></a>00434 <span class="comment">/* @} */</span>
<a name="l00435"></a>00435 <span class="comment">/* @} */</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Wed Mar 13 2013 19:56:43 for ROBOTC Drivers by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.2 </small></address>
</body>
</html>
